import Vue from 'vue'
import contextMenu from './contextMenu.vue'
const template = Vue.extend(contextMenu)
let mount = null
fn.close = _ => { }
export default function fn(params) {
    if (!mount) {
        mount = new template().$mount()
        fn.close = mount.close
        document.body.appendChild(mount.$el)
    }
    mount.init(params)
    return new Promise((resolve, reject) => {
        mount.callBack = function (state, item) {
            if (state) {
                resolve(item)
            } else {
                reject()
            }
        }
    })
}
